# Makefile for schxd.exe
OUTNAME = schxd

!if "$(DEBUG)" == ""
DEBUG = 1
!endif

!if "$(DEBUG)" == "1"
ODIR = Debug
CFLAGS = $(CFLAGS) -Od -D_DEBUG -Zi
D = d
!else
ODIR = Release
CFLAGS = $(CFLAGS) -O2 -DNDEBUG -Zi
!endif

LIBS = $(LIBS)

# linked statically
CFLAGS = -DAPPNAME=\"$(OUTNAME)\" $(CFLAGS) -MT$(D)

# _CRT_NONSTDC_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
CFLAGS   = $(CFLAGS) -c -Fd$(ODIR)\ -W3 -Y- -D_CRT_SECURE_NO_WARNINGS -EHsc -D_USE_32BIT_TIME_T
LFLAGS   = $(LFLAGS) -map -debug -PDB:$(ODIR)\$(OUTNAME).pdb

!if "$(VERBOSE)" == "1"
!message DEBUG=$(DEBUG)
!endif

OBJS = \
    $(ODIR)\$(OUTNAME).obj

all : $(ODIR)\$(OUTNAME).exe

{}.c{$(ODIR)\}.obj::
    cl $(CFLAGS) -Fo$(ODIR)\ -FR$(ODIR)\ $<

$(ODIR)\$(OUTNAME).exe : $(ODIR) $(OBJS)
    link -out:$(ODIR)\$(OUTNAME).exe $(OBJS) $(LFLAGS) $(LIBS)

$(ODIR):
    -md $(ODIR)

clean :
    del /q $(ODIR)
